home *** CD-ROM | disk | FTP | other *** search
/ Micromanía: 150 Juegos 2010 / 150Juegos_16.iso / Shareware / Juegos Flash / canyonZone.dcr / Internal_24_smokepuff.ls < prev    next >
Encoding:
Text File  |  2003-08-01  |  2.6 KB  |  81 lines

  1. property pTrackmanager, pSN, pPosition, pAnimProgression, pDirection, pStartSize, pEndSize, pDuration, pRotationSpeed, pRotation, pStartBlending, pCallBacks, pWidth, pHeight
  2. global gEffects
  3.  
  4. on new me, tTrackManager, tPosition, tInitData
  5.   pTrackmanager = tTrackManager
  6.   pSN = pTrackmanager.getSpriteManager().getSN(3, #smokepuff)
  7.   pPosition = point(tPosition[1], tPosition[2])
  8.   pStartSize = tInitData[#startsize]
  9.   pEndSize = tInitData[#endsize]
  10.   pDuration = tInitData[#duration]
  11.   pDirection = tInitData[#direction]
  12.   pRotationSpeed = tInitData[#rotationspeed]
  13.   pAnimProgression = 0
  14.   if tInitData[#startBlending] = VOID then
  15.     pStartBlending = 0
  16.   else
  17.     pStartBlending = tInitData[#startBlending]
  18.   end if
  19.   pTrackmanager.INeedADisplayUpdateEachFrame(me)
  20.   pTrackmanager.INeedAnUpdateEachFrame(me)
  21.   pCallBacks = tInitData[#callbacks]
  22.   if pCallBacks <> VOID then
  23.     docallback(pCallBacks[#start], me)
  24.   end if
  25.   sprite(pSN).member = member("smokepuffimage")
  26.   if tInitData[#backColor] <> VOID then
  27.     sprite(pSN).backColor = tInitData[#backColor]
  28.   end if
  29.   if tInitData[#foreColor] <> VOID then
  30.     sprite(pSN).foreColor = tInitData[#foreColor]
  31.   else
  32.     sprite(pSN).foreColor = 0
  33.   end if
  34.   pRotation = random(360)
  35.   return me
  36. end
  37.  
  38. on cleanUp me
  39.   pTrackmanager.IDontNeedADisplayUpdateEachFrame(me)
  40.   pTrackmanager.IDontNeedAnUpdateEachFrame(me)
  41.   pTrackmanager.getSpriteManager().returnSN(pSN, #smokepuff)
  42.   if pCallBacks <> VOID then
  43.     docallback(pCallBacks[#end], me)
  44.   end if
  45.   pCallBacks = 0
  46.   pTrackmanager = 0
  47.   return 0
  48. end
  49.  
  50. on Update me, tTimeMultiplier
  51.   pAnimProgression = pAnimProgression + (tTimeMultiplier / pDuration)
  52.   if pAnimProgression > 1 then
  53.     me.cleanUp()
  54.   end if
  55.   pWidth = pStartSize + (pAnimProgression * (pEndSize - pStartSize))
  56.   pHeight = pStartSize + (pAnimProgression * (pEndSize - pStartSize))
  57.   pPosition = pPosition + (pDirection * tTimeMultiplier / 10)
  58.   pRotation = pRotation + (tTimeMultiplier * pRotationSpeed)
  59. end
  60.  
  61. on getRect me
  62.   return rect(pPosition[1] - (pWidth / 2), pPosition[2] - (pHeight / 2), pPosition[1] + (pWidth / 2), pPosition[2] + (pHeight / 2))
  63. end
  64.  
  65. on display me, tScrollOffset
  66.   pScrollOffset = rect(tScrollOffset[1], tScrollOffset[2], tScrollOffset[1], tScrollOffset[2])
  67.   sprite(pSN).loc = pPosition + tScrollOffset
  68.   sprite(pSN).width = pWidth
  69.   sprite(pSN).height = pHeight
  70.   if gEffects[#rotation] then
  71.     sprite(pSN).rotation = pRotation
  72.   else
  73.     sprite(pSN).rotation = 0
  74.   end if
  75.   if gEffects[#blend] then
  76.     sprite(pSN).blend = 100 - (max(pAnimProgression - pStartBlending, 0) * 100 / (1 - pStartBlending))
  77.   else
  78.     sprite(pSN).blend = 100
  79.   end if
  80. end
  81.